<template>
  <div class="recommend">
    <my-swiper :focusList="focusList"></my-swiper>
    <!-- nav部分 -->
    <nav-bar :tomatoes="tomatoes"></nav-bar>
    <!-- 下载app的banner图片 -->
    <download-img></download-img>
    <re-content></re-content>


   
    <my-load v-if="isShow"></my-load>
  </div>
</template>

<script>
import ReContent from "@/views/recommend/content/ReContent.vue";

export default {
  name: "Recommend",
  data() {
    return {
      tomatoes: [],
      comlist: [],
      focusList: [],
       isShow:false
    };
  },
  components: {
    ReContent,
  },
  created() {
    this.initData();
    
  },
  methods: {
    initData() {
      let flag = localStorage.getItem('flag')
      if(flag){
        this.isShow = flag
      }
      axios({
        url: "https://apis.netstart.cn/ximalaya/index/queryIndexTabContent",
        method: "GET",
      })
        .then((res) => {
          let module = res.data.data.moduleContent;
          this.tomatoes = module.tomatoes;
          this.comlist = module.moduleRankDatas;
          module.focusImages.forEach((item) => {
            let obj = {
              img: item.adFocusPictureDetail.cover,
            };

            this.focusList.push(obj);
          });
          


          if(this.tomatoes.length > 0){
            this.isShow = false
            localStorage.setItem('flag',this.isShow)
          }
          console.log(res.data);
        })
        .catch((err) => {
          console.log("获取数据失败");
        });
    
    
    },

    
  },
};
</script>

<style lang="scss" scoped>
.recommend{
  background-color: #fff;
}
</style>

